/*
 * 风场画布元素
 * @Author: jianlei wang
 * @Date: 2023-07-07 17:33:22
 * @Last Modified by: jianlei wang
 * @Last Modified time: 2023-07-07 17:55:39
 */
export default class CanvasDom {
    parent: Element;
    canvas: HTMLCanvasElement;
    constructor(parent: Element) {
      this.parent = parent;
      this.canvas = document.createElement('canvas');
      this.init();
    }
    init() {
      this.canvas.style.position = 'fixed';
      this.canvas.style.top = '0';
      this.canvas.style.zIndex = '1';
      this.canvas.style.display = 'block';
      this.canvas.style.pointerEvents = 'none';
   
      this.parent.appendChild(this.canvas);
      setTimeout(() => {
        this.canvas.onmousemove = function (e) {
          debugger;
          console.log(e);
        };
      }, 4000);
    }
    show(bool: boolean) {
      this.canvas.style.visibility = bool ? 'visible' : 'hidden';
    }
    destroy() {
      this.parent.removeChild(this.canvas);
    }
  }